#ifndef GARBAGEBIN_H
#define GARBAGEBIN_H

#include <unordered_set>

template <typename T>
class GarbageBin
{
public:
    ~GarbageBin()
    {
        for (auto p : bin)
            delete p;
    }

    void add(T* p) { bin.insert(p); }

private:
    std::unordered_set<T*> bin;
};

#endif // GARBAGEBIN_H
